/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.lucava.boatskeeper.server.handler.role;

import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
import org.lucava.boatskeeper.server.MockRoleDao;
import org.lucava.boatskeeper.shared.rpc.role.GetRoles;
import org.lucava.boatskeeper.shared.rpc.role.GetRolesResult;

/**
 *
 * @author glenn
 */
public class GetRolesHandler implements ActionHandler<GetRoles, GetRolesResult> {

    @Override
    public Class<GetRoles> getActionType() {
        return GetRoles.class;
    }

    @Override
    public GetRolesResult execute(GetRoles a, ExecutionContext ec) throws ActionException {

        GetRolesResult getRolesResult = new GetRolesResult(MockRoleDao.getAll());

        return getRolesResult;
    }

    @Override
    public void rollback(GetRoles a, GetRolesResult r, ExecutionContext ec) throws ActionException {
    }
}
